﻿using System.Linq;
using AB.ServiceDirectory.Commons.DataFilters;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory.Entities;

namespace AB.ServiceDirectory.BO
{
    /// <summary>
    /// TypeOfBusinessBO Class
    /// </summary>
    public static class TypeOfBusinessBO
    {
        /// <summary>
        ///TypeOfBusinessDao object
        /// </summary>
        private static readonly TypeOfBusinessDao TypeOfBusinessDao = new TypeOfBusinessDao();

        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortType">Type of the sort.</param>
        /// <param name="startRowIndex">Start index of the row.</param>
        /// <param name="maxRows">The max rows.</param>
        /// <returns>BusinessType list</returns>
        public static IQueryable<BusinessType> GetList(BusinessFilters filter, string sortType, int startRowIndex,
                                                       int maxRows)
        {
            IQueryable<BusinessType> queryable = TypeOfBusinessDao.GetList(filter, sortType, startRowIndex, maxRows);
            return queryable;
        }

        /// <summary>
        /// Gets the list count.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public static int GetListCount(BusinessFilters filter)
        {
            int count = TypeOfBusinessDao.GetListCount(filter);
            return count;
        }

        /// <summary>
        /// Gets the business type by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public static BusinessType GetBusinessTypeById(int id)
        {
            BusinessType results = TypeOfBusinessDao.GetBusinessTypeById(id);
            return results;
        }
    }
}